/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.hazardsource.mapper;

import com.koron.hazardsource.domain.StandardRisk;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.koron.ebs.mybatis.EnvSource;

import java.util.List;


public interface StandardRiskMapper {
    /**
     * 根据主键获取风险信息
     * @param tableName
     * @param id
     * @return
     */
    StandardRisk queryOne(@Param("tableName") String tableName,@Param("id") String id);

    /**
     * 根据标准危险源id获取属于该危险源的风险列表
     * @param tableName
     * @param hazardSourceId
     * @param start
     * @param rows
     * @return
     */
    List<StandardRisk> queryByHazrdSourceId(@Param("tableName") String tableName,@Param("hazardSourceId")String hazardSourceId,@Param("start")Integer start,@Param("rows")Integer rows);



    /**
     * 新增风险记录
     * @param tableName
     * @param risk
     * @return
     */
    Integer insert(@Param("tableName")String tableName,@Param("risk") StandardRisk risk);

    /**
     * 批量新增风险记录
     * @param tableName
     * @param standardRiskList
     * @return
     */
    Integer batchInsert(@Param("tableName")String tableName,@Param("standardRiskList") List<StandardRisk>standardRiskList);

    /**
     * 修改风险项
     * @param tableName
     * @param risk
     * @return
     */
    Integer update(@Param("tableName")String tableName,@Param("risk") StandardRisk risk);

    /**
     * 批量修改风险记录
     * @param tableName
     * @param standardRiskList
     * @return
     */
    Integer batchUpdate(@Param("tableName")String tableName,@Param("standardRiskList") List<StandardRisk>standardRiskList);

    /**
     * 根据标准危险源id删除风险记录
     * @param tableName
     * @param hazardSourceId
     * @return
     */
    Integer deleteByHazardSourceId(@Param("tableName")String tableName,@Param("hazardSourceId") String hazardSourceId);


    
    @Delete("delete from tbl_risk_history where hazard_source_id=#{id}")
    Integer deleteDraft(@Param("id") String id);
}
